1. Field of the Invention
The invention relates in general to an electronic apparatus hibernation recovery setting method and an electronic apparatus having a hibernation state and a hibernation recovery mechanism, and more particularly, to an electronic apparatus hibernation recovery setting method and an electronic apparatus having a hibernation state and a hibernation recovery mechanism that assign different priorities for different tasks and read image files according to the priorities.
2. Description of the Related Art
In addition to a normal power-on/off procedure, an electronic apparatus is generally provided with a hibernation mechanism for prompting the electronic apparatus to enter a suspend-to-disk state, also commonly referred to as a hibernation state. Under the hibernation state, a hibernation image file recording all tasks in process on the electronic apparatus is generated and stored for all components of the electronic apparatus before entering the hibernation state. When recovering from the hibernation state, the hibernation image file is read and loaded, and the electronic apparatus is restored to a state prior to entering the hibernation state according to the hibernation image file.
The storable hibernation image file is limited to a certain size. In some prior art, a part of memory pages in the hibernation image file is relocated to swap space in a hard drive through a predetermined algorithm and stored therein. After completing the recovery from the hibernation state, the relocated memory pages are loaded by a habitual page fault process of a virtual memory to solve the issue of insufficient memory. Although the above conventional solution effectively overcomes the issue of insufficient memory, inevitable lag occurring in a normal operation period is resulted from the page default process for loading the memory pages in the hard drive. In designs of certain hibernation mechanisms, data of a colossal amount of memory pages need to be placed into swap space, which further leads to a greater lag. For example, in a Software Suspend algorithm of a conventional hibernation technique, a total number of at least one-half of the memory pages need to be placed into swap space.
In another conventional hibernation technique, e.g., TuxOnIce, the number of memory pages placed into swap space is reduced to below one-half. However, an electronic apparatus exits a hibernation state and starts executing all tasks only when a hibernation image file corresponding to all the tasks is altogether read and completely loaded, such that a time required for recovering from the hibernation state may be extended. Such occurrence is aggravated as the number of tasks in process becomes larger. Consequently, as all tasks have different priorities and tasks with higher priorities can only be operated after recovering and executing all the tasks, the hibernation recovery of an electronic apparatus utilizing the above hibernation mechanism is quite inefficient.